#include <iostream>
#include <string>
#include <memory>

using namespace std;

int main()
{
    unique_ptr<int> ptr( new int[10]);
    string s = "ABCDCABDEFG";
    string t = "ABD";

    uint i = 0;
    uint j = 0;
    while (i < s.size() && j < t.size())
    {
        if(s[i] == t[j])
        {
            i++;
            j++;
        }else
        {
            i = i - j + 1;
            j = 0;
        }
    }

    if(j == t.size())
    {
        //在主串种找到了子串
        cout << "i :" << i <<endl;
        cout << "t.size" << t.size() << endl;
        cout << "find it : " << i - t.size() << endl;
    }
    else
    {
        cout << "can`t find it" <<endl;
        //没有找到
    }
    
}